import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created with IntelliJ IEDA.
 * Description:
 * User:86186
 * Date:2022-11-29
 * Time:21:10
 */
@WebServlet("/autorefresh")
public class AutoRefreshServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //直接返回响应
        resp.setHeader("refresh","2");
        //返回一个时间戳
        resp.getWriter().write(System.currentTimeMillis() + "");
    }
}
